class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        res, start, end = 0, 0, 0
        while end < len(s):
            idx = s.find(s[end], start, end)
            if idx != -1:
                res, start = max(res, end - start), idx + 1
            end += 1
        res = max(res, end - start)
        return res

s = "abcabcbb"
s="1112113"
print(Solution().lengthOfLongestSubstring(s))
